package com.shan.learn.springbootrabbitmq;

import com.shan.learn.springbootrabbitmq.dto.SendMqData;
import com.shan.learn.springbootrabbitmq.dto.UserMQDto;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


/**
 * @author china@shanjun.wang
 * 监听的队列名称 TestDirectQueue
 */
@Component
public class DirectReceiver {

    @RabbitListener(queues = "TestDirectQueue")
    public void process(SendMqData sendMqDate) {
        System.out.println("DirectReceiver消费者收到消息1  : " + sendMqDate.toString());
        System.out.println("DirectReceiver消费者收到消息2  : " + sendMqDate.getMsgId());
        System.out.println("DirectReceiver消费者收到消息2  : " + ((UserMQDto)sendMqDate.getData()).getUserName());

    }

}